home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / m / exp.man < prev    next >
Encoding:
Text File  |  1989-01-27  |  4.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4. EXP              Mathematical Library Procedures              EXP
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      exp, expm1, log, log10, log1p, pow - exponential, logarithm,
  10.      power
  11.  
  12. SSYYNNOOPPSSIISS
  13.      ##iinncclluuddee <<mmaatthh..hh>>
  14.  
  15.      ddoouubbllee eexxpp((xx))
  16.      ddoouubbllee xx;;
  17.  
  18.      ddoouubbllee eexxppmm11((xx))
  19.      ddoouubbllee xx;;
  20.  
  21.      ddoouubbllee lloogg((xx))
  22.      ddoouubbllee xx;;
  23.  
  24.      ddoouubbllee lloogg1100((xx))
  25.      ddoouubbllee xx;;
  26.  
  27.      ddoouubbllee lloogg11pp((xx))
  28.      ddoouubbllee xx;;
  29.  
  30.      ddoouubbllee ppooww((xx,,yy))
  31.      ddoouubbllee xx,,yy;;
  32.  
  33. DDEESSCCRRIIPPTTIIOONN
  34.      Exp returns the exponential function of x.
  35.  
  36.      Expm1 returns exp(x)-1 accurately even for tiny x.
  37.  
  38.      Log returns the natural logarithm of x.
  39.  
  40.      Log10 returns the logarithm of x to base 10.
  41.  
  42.      Log1p returns log(1+x) accurately even for tiny x.
  43.  
  44.      Pow(x,y) returns x**y.
  45.  
  46. EERRRROORR ((dduuee ttoo RRoouunnddooffff eettcc..))
  47.      exp(x), log(x), expm1(x) and log1p(x) are accurate to within
  48.      an _u_l_p, and log10(x) to within about 2 _u_l_ps; an _u_l_p is one
  49.      _Unit in the _Last _Place.  The error in pow(x,y) is below
  50.      about 2 _u_l_ps when its magnitude is moderate, but increases
  51.      as pow(x,y) approaches the over/underflow thresholds until
  52.      almost as many bits could be lost as are occupied by the
  53.      floating-point format's exponent field; that is 8 bits for
  54.      VAX D and 11 bits for IEEE 754 Double.  No such drastic loss
  55.      has been exposed by testing; the worst errors observed have
  56.      been below 20 _u_l_ps for VAX D, 300 _u_l_ps for IEEE 754 Double.
  57.      Moderate values of pow are accurate enough that
  58.      pow(integer,integer) is exact until it is bigger than 2**56
  59.      on a VAX, 2**53 for IEEE 754.
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 27, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. EXP              Mathematical Library Procedures              EXP
  71.  
  72.  
  73.  
  74. DDIIAAGGNNOOSSTTIICCSS
  75.      Exp, expm1 and pow return the reserved operand on a VAX when
  76.      the correct value would overflow, and they set _e_r_r_n_o to
  77.      ERANGE.  Pow(x,y) returns the reserved operand on a VAX and
  78.      sets _e_r_r_n_o to EDOM when x < 0 and y is not an integer.
  79.  
  80.      On a VAX, _e_r_r_n_o is set to EDOM and the reserved operand is
  81.      returned by log unless x > 0, by log1p unless x > -1.
  82.  
  83. NNOOTTEESS
  84.      The functions exp(x)-1 and log(1+x) are called expm1 and
  85.      logp1 in BASIC on the Hewlett-Packard HP-71B and APPLE
  86.      Macintosh, EXP1 and LN1 in Pascal, exp1 and log1 in C on
  87.      APPLE Macintoshes, where they have been provided to make
  88.      sure financial calculations of ((1+x)**n-1)/x, namely
  89.      expm1(n*log1p(x))/x, will be accurate when x is tiny.  They
  90.      also provide accurate inverse hyperbolic functions.
  91.  
  92.      Pow(x,0) returns x**0 = 1 for all x including x = 0, Infin-
  93.      ity (not found on a VAX), and _N_a_N (the reserved operand on a
  94.      VAX).  Previous implementations of pow may have defined x**0
  95.      to be undefined in some or all of these cases.  Here are
  96.      reasons for returning x**0 = 1 always:
  97.  
  98.      (1) Any program that already tests whether x is zero (or
  99.          infinite or _N_a_N) before computing x**0 cannot care
  100.          whether 0**0 = 1 or not. Any program that depends upon
  101.          0**0 to be invalid is dubious anyway since that
  102.          expression's meaning and, if invalid, its consequences
  103.          vary from one computer system to another.
  104.  
  105.      (2) Some Algebra texts (e.g. Sigler's) define x**0 = 1 for
  106.          all x, including x = 0.  This is compatible with the
  107.          convention that accepts a[0] as the value of polynomial
  108.          p(x) = a[0]*x**0 + a[1]*x**1 + a[2]*x**2 +...+ a[n]*x**n
  109.  
  110.          at x = 0 rather than reject a[0]*0**0 as invalid.
  111.  
  112.      (3) Analysts will accept 0**0 = 1 despite that x**y can
  113.          approach anything or nothing as x and y approach 0
  114.          independently.  The reason for setting 0**0 = 1 anyway
  115.          is this:
  116.  
  117.          If x(z) and y(z) are _a_n_y functions analytic (expandable
  118.          in power series) in z around z = 0, and if there x(0) =
  119.          y(0) = 0, then x(z)**y(z) -> 1 as z -> 0.
  120.  
  121.      (4) If 0**0 = 1, then infinity**0 = 1/0**0 = 1 too; and then
  122.          _N_a_N**0 = 1 too because x**0 = 1 for all finite and
  123.          infinite x, i.e., independently of x.
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 27, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. EXP              Mathematical Library Procedures              EXP
  137.  
  138.  
  139.  
  140. SSEEEE AALLSSOO
  141.      math(3M), infnan(3M)
  142.  
  143. AAUUTTHHOORR
  144.      Kwok-Choi Ng, W. Kahan
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0               May 27, 1986                          3
  196.  
  197.  
  198.  
  199.